<?php
$this->pageTitle = Yii::t('view', 'Izin');
$this->breadcrumbs=array(
	Yii::t('view', 'Izin') => array('admin'),
);
?>
<div class="panel panel-default">
  <div class="panel-heading">
    <h3 class="panel-title"><?php echo Yii::t('view','DATA PERIZINAN');?></h3>
  </div>
    <div class="panel-body">    
        <div class="add-new-form">
            <?php
            echo CHtml::link("<i class='fa fa-plus'></i> " . Yii::t('view', 'Tambah Data'), array('perusahaan/create'), array('class' => 'btn btn-info'));
            ?>
        </div>
        <?php $this->widget('booster.widgets.TbGridView',array(
            'id'=>Yii::app()->controller->id.'-grid',
            'type' => 'striped bordered condensed',
            'dataProvider' => $model->search(),
            'filter' => $model,
            'responsiveTable' => true,
            'columns' => array(
                                array(
                                    'name' => 'perusahaan_id',
                                    'value' => '($data->perusahaan) ? $data->perusahaan->nama_perusahaan : "-"',
                                ),array(
                                        'name' => 'jenis_izin',
                                        'value' => '($data->jenis_izin) ? $data->perusahaan->jenis_usaha." ".$data->jenis_izin: "-"',
                                ),array(
                                        'name' => 'lokasi',
                                        'value' => '($data->lokasi && $data->provinsi) ? $data->lokasi.", ".$data->provinsi->nama : $data->kabupaten->nama.", ".$data->provinsi->nama',
                                ),array(
                                        'name' => 'kapasitas_pengolahan',
                                        'filter'=>false,
                                        'value' => '($data->kapasitas_pengolahan) ? $data->kapasitas_pengolahan." ".$data->satuan->nama : "-"',
                                ),array(
                                        'name' => 'status_izin',
                                        'filter' => CHtml::dropDownList(get_class($model) . '[status_izin]', $model->status_izin, array('Masih Berlaku'=>'Masih Berlaku','Dalam Proses'=>'Dalam Proses','Kadaluarsa'=>'Kadaluarsa',''=>'Pilih Status..'), array('class' => 'form-control')),
                                        'value' => '$data->status_izin',
                                ),array(
                                        'name' => 'tanggal_berakhir',
                                        'filter'=>false,
                                        'value' => '($data->tanggal_berakhir && $data->tanggal_berakhir!=="0000-00-00") ? $data->tanggal_berakhir : "-"',
                                ),array(
                                        'htmlOptions' => array('nowrap'=>'nowrap','class'=>'button-column'),
                                        'class'=>'booster.widgets.TbButtonColumn',
                                        'template'=>'{view} {update} {delete}',
                                        'buttons'=>array(
                                            'update'=>array(
                                                'url'=>'array("perusahaan/update/".$data->perusahaan_id)',
                                            ),
                                            'delete'=>array(
                                                'visible'=>'Yii::app()->user->isAdmin()',
                                                'url'=>'array("perusahaan/delete/".$data->perusahaan_id)',
                                            )
                                        ),
                                ),
            )
        )
    ); 
        ?>
        <div style="display: none;" tabindex="-1" class="modal fade" id="myModal"></div>
    </div>
</div>